package com.yycx.module.bus.provider.handler.haiying.tasktodo.saleman;

import com.yycx.module.bus.provider.service.BusSalemanService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 业务员审批结束监听器
 *
 * @author zyf
 */
@Component
@Slf4j
public class SaleManProcessEndListener implements ExecutionListener {
    @Autowired
    private BusSalemanService saleManService;

    @Override
    public void notify(DelegateExecution delegateExecution) {
        String businessKey = delegateExecution.getProcessInstanceBusinessKey();
        saleManService.updateSaleManState(Long.parseLong(businessKey),delegateExecution.getProcessInstanceId(), 1);
    }

}
